package com.ah.shanxi_demo.convert;

import com.ah.shanxi_demo.entity.SxOrderReceipt;
import com.ah.shanxi_demo.param.input.ReceiptPO;
import com.ah.shanxi_demo.sync.param.result.SyncReceiptResult;
import org.springframework.beans.BeanUtils;

/**
 * @author zt 2020/8/26
 */
public class ConvertOrderReceipt {


    /**
     * ReceiptPO-->SyncReceiptResult 转换为部级平台回执接口参数
     * @param syncReceiptResult
     * @param receiptPO
     * @return
     */
    public static SyncReceiptResult convert_sync_receipt_po(SyncReceiptResult syncReceiptResult, ReceiptPO receiptPO){

        if (null==syncReceiptResult){
            return null;
        }
        syncReceiptResult.setAccdept(receiptPO.getAccdept());
        syncReceiptResult.setAccuser(receiptPO.getAccuser());
        syncReceiptResult.setPhone(receiptPO.getPhone());
        syncReceiptResult.setContent(receiptPO.getReceiptContent());
        syncReceiptResult.setAttach_flag(receiptPO.getAttachFlag());
        syncReceiptResult.setAttach_name(receiptPO.getAttachName());
        syncReceiptResult.setAttach_content(receiptPO.getAttachContent());

        return syncReceiptResult;
    }


    /**
     * 回执类型转换
     * receiptPO ---> SxOrderReceipt
     * @param receiptPO
     * @return
     */
    public static SxOrderReceipt convert_sx_order_receipt(ReceiptPO receiptPO) {

        SxOrderReceipt model = new SxOrderReceipt();
        BeanUtils.copyProperties(model, receiptPO);

        return model;
    }

}
